//懒汉模式多线程优化
public class Singleton3 {
    private static Singleton3 instance=null;

    public Singleton3() {
    }
    public static Singleton3 getInstance(){
        if(instance==null){
         synchronized (Singleton3.class){
             if (instance==null){
                 instance=new Singleton3();
             }
         }
        }
        return instance;
    }
}
